package com.lar.ultimte.controller;

import com.lar.ultimte.dao.UserDao;
import com.lar.ultimte.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author angelar
 * @date 2019-07-05 15:09
 */
@RestController
@RequestMapping(value = "/myuser")
public class UserController {
    @Autowired
    private UserDao userDao;

    @RequestMapping(value = "/home")
    public String home(){
        return "Hello user!";
    }
    @RequestMapping(value = "/bye")
    public String bye(){
        return "bye user!";
    }
    @RequestMapping(value="/showall")
    public List<User> showall(){
        return userDao.queryAllUser();
    }
    @RequestMapping(value="/showuser1")
    public User showuser1(){
        return userDao.queryUserById(1);
    }
}
